<include file="Public:header_user"/>

<div class="title_member">
	<h2>{$_title}</h2>
</div>
<form action="" method="post" class="ajax-form">
<div class="form-box mt-40">
	<notempty name="set_password">
	<div class="mod">
		<div class="name">登陆密码</div>
		<div class="text">
			<input type="password" name="password" placeholder="请输入登陆密码" datatype="*">
		</div>
	</div>
	</notempty>

	<div class="mod">
		<div class="name">手机号</div>
		<div class="text">
			<input type="text" name="mobile" class="mobile" placeholder="请输入新的手机号" autocomplete="off" datatype="mobile">
		</div>
	</div>

	<div class="mod">
		<div class="name">短信验证码</div>
		<div class="text">
			<input type="text" name="smscode" class="smscode" placeholder="短信验证码" autocomplete="off" datatype="*">
			<span class="get-smscode">获取验证码</span>
			<span class="show-time" style="display: none"><span>60</span>s</span>
		</div>
	</div>

	<div class="submit-mod">
		<input class="btn" type="submit" value="保存">
	</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
	//获取验证码
	$('.get-smscode').click(function () {
		var mobile  = $('.mobile').val();
		if(!mobile){
			msgbox('手机号不能为空！', 'error');
			return false;
		}
		loading('获取验证码中...');
		$.ajax({
			type: "get",
			url: "{:U('get_smscode')}",
			data: 'mobile=' + mobile + '&type=update_mobile',
			dataType: "json",
			success: function(data){
				removeLoading();
				if(data.status==200){
					$('.get-smscode').hide();
					$('.show-time').show().find('span').text(60);
					msgbox(data.info);
					var wait = $('.show-time span');
					var smscode_interval = setInterval(function(){
						var time = wait.text();
							--time;
							wait.text(time);
						if(time == 0) {
							$('.show-time').hide();
							$('.get-smscode').show();
							clearInterval(smscode_interval);
						};
					}, 1000);
				}else{
					msgbox(data.info,'error');
				}
			},
			error : function () {
				removeLoading();
				msgbox('请求失败！','error');
			}
		});
	});
})
</script>
<include file="Public:footer_user"/>